<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>v-bind</title>
    <style>
        .active {
            border: 5px solid red;
        }
    </style>
</head>
<!-- 这个表达式可以修改元素的属性 -->

<body>
    <div id="app">
        <!-- 这个是完整的写法 -->
        <img v-bind:src="isImg" style="width: 200px;height:100px;" alt="">
        <br>
        <!-- 可以用简写的方式来写 -->
        <!-- 利用三元表达式来写一个活动样式 -->
        <img :src="isImg" :title="Imgtitle+'!!'" style="width: 200px;height:100px;" :class="
        isActive?'active':''" @click="addcss">
        <br>
        <!--通过对象的方法来添加活动样式 -->
        <img :src="isImg" style="width: 200px;height:100px;" alt="" :class="
        {active:isActive}" @click="addcss">

    </div>
</body>
<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
<script>
    var app = new Vue({
        el: "#app",
        data: {
            isImg: "https://img2.baidu.com/it/u=574544660,2678578901&fm=253&fmt=auto&app=138&f=JPEG?w=889&h=500",
            Imgtitle: "to yung to simple",
            isActive: false
        },
        methods: {
            addcss: function() {
                this.isActive = !this.isActive;
            }
        }
    })
</script>

</html>